package com.shareware.common.utils

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.widget.Toast
import com.shareware.common.getContextGlobal

/**
 * desc: 功能描述
 * email: mobiledeveloper@qq.com
 */

fun Context?.showToast(content: String) {
    if (this != null) {
        Toast.makeText(this, content, Toast.LENGTH_SHORT).show()
    } else {
        Toast.makeText(getContextGlobal(), content, Toast.LENGTH_SHORT).show()
    }
}

fun Context?.showToastLong(content: String) {
    if (this != null) {
        Toast.makeText(this, content, Toast.LENGTH_LONG).show()
    } else {
        Toast.makeText(getContextGlobal(), content, Toast.LENGTH_LONG).show()
    }
}

inline fun <reified T : Activity> Context.startActivity() {
    startActivity(Intent(this, T::class.java))
}